gdk: Remove gdk_surface_move()
authorJonas Ådahl <jadahl@gmail.com>
Mon, 15 Jul 2019 09:32:35 +0000 (11:32 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Thu, 25 Jul 2019 08:24:50 +0000 (10:24 +0200)
Generic gdk code now uses the internal helper; backends use their own
private implementations when necessary.

gdk/broadway/gdksurface-broadway.c
gdk/gdkinternals.h
gdk/gdksurface.c
gdk/win32/gdkdrag-win32.c
gdk/win32/gdksurface-win32.c
gdk/win32/gdksurface-win32.h
gdk/x11/gdkdrag-x11.c
gdk/x11/gdksurface-x11.c
gdk/x11/gdksurface-x11.h

index 097b53facf9646b06a1e11dfa1f52bf1e1fcbfa3..d3da0740303e7ed8fd503b446e7a717a3f00f5b2 100644 (file)
@@ -432,6 +432,14 @@ gdk_broadway_surface_toplevel_resize (GdkSurface *surface,
   gdk_broadway_surface_move_resize (surface, FALSE, 0, 0, width, height);
 }
 
+static void
+gdk_broadway_surface_move (GdkSurface *surface,
+                           gint        x,
+                           gint        y)
+{
+  gdk_broadway_surface_move_resize (surface, TRUE, x, y, -1, -1);
+}
+
 static void
 gdk_broadway_surface_raise (GdkSurface *surface)
 {
@@ -952,7 +960,7 @@ update_pos (MoveResizeData *mv_resize,
       x = mv_resize->moveresize_orig_x + dx;
       y = mv_resize->moveresize_orig_y + dy;
 
-      gdk_surface_move (mv_resize->moveresize_surface, x, y);
+      gdk_broadway_surface_move (mv_resize->moveresize_surface, x, y);
     }
 }
 
index 13b139f5ce4ad9b0d340fe3147d855d60343e208..236799d2bf9478538a4df69243602e46a7837b94 100644 (file)
@@ -264,10 +264,6 @@ void gdk_surface_get_geometry (GdkSurface *surface,
                                gint       *width,
                                gint       *height);
 
-void gdk_surface_move         (GdkSurface *surface,
-                               gint           x,
-                               gint           y);
-
 void gdk_surface_move_resize  (GdkSurface     *surface,
                                gint           x,
                                gint           y,
index 6a29aa6ddf2097415e80be69b2f6c4a86622d11d..e5c41e68c441eda9ffd1e7aa72aafa494f6d8483 100644 (file)
@@ -108,6 +108,13 @@ static void update_cursor               (GdkDisplay *display,
 static void gdk_surface_set_frame_clock (GdkSurface      *surface,
                                          GdkFrameClock  *clock);
 
+static void gdk_surface_move_resize_internal (GdkSurface *surface,
+                                              gboolean   with_move,
+                                              gint       x,
+                                              gint       y,
+                                              gint       width,
+                                              gint       height);
+
 
 static guint signals[LAST_SIGNAL] = { 0 };
 static GParamSpec *properties[LAST_PROP] = { NULL, };
@@ -365,7 +372,7 @@ gdk_surface_real_move_to_rect (GdkSurface         *surface,
   if (final_rect.width != surface->width || final_rect.height != surface->height)
     gdk_surface_move_resize (surface, final_rect.x, final_rect.y, final_rect.width, final_rect.height);
   else
-    gdk_surface_move (surface, final_rect.x, final_rect.y);
+    gdk_surface_move_resize_internal (surface, TRUE, final_rect.x, final_rect.y, -1, -1);
 
   gdk_surface_get_origin (toplevel, &x, &y);
   final_rect.x -= x;
@@ -2100,31 +2107,6 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
   gdk_surface_move_resize_toplevel (surface, with_move, x, y, width, height);
 }
 
-
-
-/*
- * gdk_surface_move:
- * @surface: a #GdkSurface
- * @x: X coordinate relative to surface’s parent
- * @y: Y coordinate relative to surface’s parent
- *
- * Repositions a surface relative to its parent surface.
- * For toplevel surfaces, window managers may ignore or modify the move;
- * you should probably use gtk_window_move() on a #GtkWindow widget
- * anyway, instead of using GDK functions. For child surfaces,
- * the move will reliably succeed.
- *
- * If you’re also planning to resize the surface, use gdk_surface_move_resize()
- * to both move and resize simultaneously, for a nicer visual effect.
- **/
-void
-gdk_surface_move (GdkSurface *surface,
-                  gint       x,
-                  gint       y)
-{
-  gdk_surface_move_resize_internal (surface, TRUE, x, y, -1, -1);
-}
-
 /**
  * gdk_surface_resize:
  * @surface: a #GdkSurface
index 1e8ecf3474cee5695fae61ce82c5b95fde798f90..f8e1ce764890f71d3893c4853da6bee2b1b8f4c9 100644 (file)
@@ -736,9 +736,9 @@ move_drag_surface (GdkDrag *drag,
   g_assert (_win32_main_thread == NULL ||
             _win32_main_thread == g_thread_self ());
 
-  gdk_surface_move (drag_win32->drag_surface,
-                    x_root - drag_win32->hot_x,
-                    y_root - drag_win32->hot_y);
+  gdk_win32_surface_move (drag_win32->drag_surface,
+                          x_root - drag_win32->hot_x,
+                          y_root - drag_win32->hot_y);
   gdk_surface_raise (drag_win32->drag_surface);
 }
 
@@ -2090,6 +2090,7 @@ gdk_drag_anim_timeout (gpointer data)
   gint64 current_time;
   double f;
   double t;
+  gint x, y;
 
   if (!frame_clock)
     return G_SOURCE_REMOVE;
@@ -2104,9 +2105,13 @@ gdk_drag_anim_timeout (gpointer data)
   t = ease_out_cubic (f);
 
   gdk_surface_show (drag->drag_surface);
-  gdk_surface_move (drag->drag_surface,
-                    drag->util_data.last_x + (drag->start_x - drag->util_data.last_x) * t - drag->hot_x,
-                    drag->util_data.last_y + (drag->start_y - drag->util_data.last_y) * t - drag->hot_y);
+  x = (drag->util_data.last_x +
+       (drag->start_x - drag->util_data.last_x) * t -
+       drag->hot_x);
+  y = (drag->util_data.last_y +
+       (drag->start_y - drag->util_data.last_y) * t -
+       drag->hot_y);
+  gdk_win32_surface_move (drag->drag_surface, x, y);
   gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
 
   return G_SOURCE_CONTINUE;
index 720426583f7f8e6365f7821779aecb36f5a9a756..32d853b8d7c1bf69ec31fbe1fbb5bb72c612b697 100644 (file)
@@ -1098,8 +1098,8 @@ gdk_win32_surface_withdraw (GdkSurface *window)
 }
 
 static void
-gdk_win32_surface_move (GdkSurface *window,
-                      gint x, gint y)
+gdk_win32_surface_do_move (GdkSurface *window,
+                           gint x, gint y)
 {
   RECT outer_rect;
   GdkWin32Surface *impl;
@@ -1242,7 +1242,7 @@ gdk_win32_surface_move_resize (GdkSurface *window,
 
   if (with_move && (width < 0 && height < 0))
     {
-      gdk_win32_surface_move (window, x, y);
+      gdk_win32_surface_do_move (window, x, y);
     }
   else
     {
@@ -1270,6 +1270,14 @@ gdk_win32_surface_toplevel_resize (GdkSurface *surface,
   gdk_win32_surface_move_resize  (surface, FALSE, 0, 0, width, height);
 }
 
+void
+gdk_win32_surface_move (GdkSurface *surface,
+                        gint        x,
+                        gint        y)
+{
+  gdk_win32_surface_move_resize (surface, TRUE, x, y, -1, -1);
+}
+
 static void
 gdk_win32_surface_raise (GdkSurface *window)
 {
index 1d6c4b36268f85853934ba4b49fbad7d41d566b2..89860617b756e8eab7c445f3e765ca7aa828033c 100644 (file)
@@ -361,6 +361,9 @@ void  _gdk_win32_update_layered_window_from_cache (GdkSurface *window,
                                                    gboolean    do_resize,
                                                    gboolean    do_paint);
 
+void gdk_win32_surface_move (GdkSurface *surface,
+                             gint        x,
+                             gint        y);
 
 void
 gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
index 65b2b71075b0ace79c7fdc5140d928cf737bf371..3bfb04121cdbb1592ffbf204ba0bad0a7f0a8cc8 100644 (file)
@@ -1459,9 +1459,9 @@ move_drag_surface (GdkDrag *drag,
 {
   GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
 
-  gdk_surface_move (drag_x11->drag_surface,
-                   x_root - drag_x11->hot_x,
-                   y_root - drag_x11->hot_y);
+  gdk_x11_surface_move (drag_x11->drag_surface,
+                        x_root - drag_x11->hot_x,
+                        y_root - drag_x11->hot_y);
   gdk_surface_raise (drag_x11->drag_surface);
 }
 
@@ -1841,9 +1841,9 @@ gdk_drag_anim_timeout (gpointer data)
   t = ease_out_cubic (f);
 
   gdk_surface_show (drag->drag_surface);
-  gdk_surface_move (drag->drag_surface,
-                   drag->last_x + (drag->start_x - drag->last_x) * t,
-                   drag->last_y + (drag->start_y - drag->last_y) * t);
+  gdk_x11_surface_move (drag->drag_surface,
+                        drag->last_x + (drag->start_x - drag->last_x) * t,
+                        drag->last_y + (drag->start_y - drag->last_y) * t);
   gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
 
   return G_SOURCE_CONTINUE;
index 9859518e8b25b78894b4f5971396394ab953abdb..1ad97c2f7fd1842d1a4d0eecf228088f226b478d 100644 (file)
@@ -1400,6 +1400,14 @@ gdk_x11_surface_toplevel_resize (GdkSurface *surface,
   x11_surface_resize (surface, width, height);
 }
 
+void
+gdk_x11_surface_move (GdkSurface *surface,
+                      gint        x,
+                      gint        y)
+{
+  gdk_x11_surface_move_resize (surface, TRUE, x, y, -1, -1);
+}
+
 static void gdk_x11_surface_restack_toplevel (GdkSurface *surface,
                                               GdkSurface *sibling,
                                               gboolean    above);
@@ -3253,7 +3261,7 @@ gdk_x11_surface_fullscreen_on_monitor (GdkSurface  *surface,
     return;
 
   gdk_monitor_get_geometry (monitor, &geom);
-  gdk_surface_move (surface, geom.x, geom.y);
+  gdk_x11_surface_move (surface, geom.x, geom.y);
 
   gdk_surface_set_fullscreen_mode (surface, GDK_FULLSCREEN_ON_CURRENT_MONITOR);
   gdk_x11_surface_fullscreen (surface);
@@ -3904,7 +3912,7 @@ update_pos (MoveResizeData *mv_resize,
       x = mv_resize->moveresize_orig_x + dx;
       y = mv_resize->moveresize_orig_y + dy;
 
-      gdk_surface_move (mv_resize->moveresize_surface, x, y);
+      gdk_x11_surface_move (mv_resize->moveresize_surface, x, y);
     }
 }
 
index c890d6c13fefc487eeed5ef4191a3206c4aaeb93..fe0ece1c19971f96723a4e59f671c8dba475e515 100644 (file)
@@ -183,6 +183,10 @@ void            _gdk_x11_surface_set_surface_scale   (GdkSurface *window,
 
 void            gdk_x11_surface_pre_damage           (GdkSurface *surface);
 
+void            gdk_x11_surface_move                 (GdkSurface *surface,
+                                                      gint        x,
+                                                      gint        y);
+
 G_END_DECLS
 
 #endif /* __GDK_X11_SURFACE__ */